//
//  CheckingRecordCustomCell.m
//  YIJU2.0HD
//
//  Created by 张金国 on 16/5/17.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "CheckingRecordCustomCell.h"
#import "Masonry.h"
#import "UIColor+RandomColor.h"
#import "Macro.h"



@interface CheckingRecordCustomCell ()

@property (nonatomic ,strong)UIView     *customContentView;

@property (nonatomic ,strong)UILabel    *personNameLabel;

@property (nonatomic ,strong)UILabel    *timeLabel;

@property (nonatomic ,strong)UILabel    *recordLabel;

@property (nonatomic ,strong)UILabel    *detailRecordLabel;

@property (nonatomic ,strong)UILabel    *reviewQuestionLabel;

@property (nonatomic ,strong)UILabel    *detailReviewQuestionLabel;

@property (nonatomic ,strong)UILabel    *impressionLabel;

@property (nonatomic ,strong)UILabel    *detailImpressionLabel;


@end

@implementation CheckingRecordCustomCell
#pragma mark - init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = [UIColor colorWithRed:0.8902 green:0.902 blue:0.9451 alpha:1.0];
        [self setupConstraint];
    }
    return self;
}
#pragma mark - private
- (void)setupConstraint {
    [self.customContentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.equalTo(self.contentView).offset(TenOffsetViewMargin);
        make.right.bottom.equalTo(self.contentView).offset(-TenOffsetViewMargin);
    }];
    
    [self.personNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.customContentView.mas_top).offset(TenOffsetViewMargin);
        make.right.equalTo(self.customContentView.mas_right).offset(-TenOffsetViewMargin);
        make.width.equalTo(self.customContentView.mas_width).multipliedBy(0.3);
        make.height.equalTo(@20);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.personNameLabel.mas_top);
        make.right.equalTo(self.personNameLabel.mas_left).offset(-TenOffsetViewMargin);
        make.height.equalTo(self.personNameLabel.mas_height);
    }];
    
    [self.recordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.timeLabel.mas_bottom).offset(TenOffsetViewMargin);
        make.left.equalTo(self.customContentView.mas_left).offset(TenOffsetViewMargin);
        make.width.equalTo(self.customContentView.mas_width).multipliedBy(0.19);
    }];
    
    [self.detailRecordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.recordLabel.mas_top);
        make.left.equalTo(self.recordLabel.mas_right).offset(TenOffsetViewMargin);
        make.right.equalTo(self.customContentView.mas_right).offset(-TenOffsetViewMargin);
    }];
    
    [self.reviewQuestionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.detailRecordLabel.mas_bottom).offset(TenOffsetViewMargin);
        make.left.equalTo(self.customContentView.mas_left).offset(TenOffsetViewMargin);
        make.width.equalTo(self.customContentView.mas_width).multipliedBy(0.19);
    }];
    
    [self.detailReviewQuestionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.reviewQuestionLabel.mas_top);
        make.left.equalTo(self.reviewQuestionLabel.mas_right).offset(TenOffsetViewMargin);
        make.right.equalTo(self.customContentView.mas_right).offset(-TenOffsetViewMargin);

    }];
    
    [self.impressionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.detailReviewQuestionLabel.mas_bottom).offset(TenOffsetViewMargin);
        make.left.equalTo(self.customContentView.mas_left).offset(TenOffsetViewMargin);
        make.width.equalTo(self.customContentView.mas_width).multipliedBy(0.19);
    }];

    [self.detailImpressionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.impressionLabel.mas_top);
        make.left.equalTo(self.impressionLabel.mas_right).offset(TenOffsetViewMargin);
        make.right.equalTo(self.customContentView.mas_right).offset(-TenOffsetViewMargin);
        make.bottom.equalTo(self.customContentView.mas_bottom).offset(-TenOffsetViewMargin);
    }];

    
}
#pragma mark - getters
- (UIView *)customContentView {
    if (!_customContentView) {
        _customContentView = [[UIView alloc]init];
        _customContentView.backgroundColor = [UIColor colorWithRed:0.8902 green:0.902 blue:0.9451 alpha:1.0];
        _customContentView.layer.borderWidth = 1.0f;
        _customContentView.layer.borderColor = [UIColor colorWithRed:0.8588 green:0.8667 blue:0.9059 alpha:1.0].CGColor;
        _customContentView.layer.cornerRadius = 5.0f;
        _customContentView.layer.masksToBounds = YES;
        [self.contentView addSubview:_customContentView];
    }
    return _customContentView;
}

- (UILabel *)personNameLabel {
    if (!_personNameLabel) {
        _personNameLabel = [[UILabel alloc]init];
        _personNameLabel.backgroundColor = [UIColor clearColor];
        _personNameLabel.textColor = kTextColor;
        [self.customContentView addSubview:_personNameLabel];
    }
    return _personNameLabel;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.backgroundColor = [UIColor clearColor];
        _timeLabel.textColor = kTextColor;
        [self.customContentView addSubview:_timeLabel];
    }
    return _timeLabel;
}

- (UILabel *)recordLabel {
    if (!_recordLabel) {
        _recordLabel = [[UILabel alloc]init];
        _recordLabel.text = @"看房记录：";
        _recordLabel.backgroundColor = [UIColor clearColor];
        _recordLabel.textColor = [UIColor colorWithRed:0.3961 green:0.7569 blue:0.9333 alpha:1.0];
        [self.customContentView addSubview:_recordLabel];
    }
    return _recordLabel;
}

- (UILabel *)detailRecordLabel {
    if (!_detailRecordLabel) {
        _detailRecordLabel = [[UILabel alloc]init];
        _detailRecordLabel.numberOfLines = 0;
        _detailRecordLabel.backgroundColor = [UIColor clearColor];
        _detailRecordLabel.textColor = kTextColor;
        [self.customContentView addSubview:_detailRecordLabel];
    }
    return _detailRecordLabel;
}

- (UILabel *)reviewQuestionLabel {
    if (!_reviewQuestionLabel) {
        _reviewQuestionLabel = [[UILabel alloc]init];
        _reviewQuestionLabel.text = @"提出问题：";
        _reviewQuestionLabel.backgroundColor = [UIColor clearColor];
        _reviewQuestionLabel.textColor = [UIColor colorWithRed:0.9451 green:0.8157 blue:0.4 alpha:1.0];
        [self.customContentView addSubview:_reviewQuestionLabel];
    }
    return _reviewQuestionLabel;
}

- (UILabel *)detailReviewQuestionLabel {
    if (!_detailReviewQuestionLabel) {
        _detailReviewQuestionLabel = [[UILabel alloc]init];
        _detailReviewQuestionLabel.numberOfLines = 0;
        _detailReviewQuestionLabel.backgroundColor = [UIColor clearColor];
        _detailReviewQuestionLabel.textColor = kTextColor;
        [self.customContentView addSubview:_detailReviewQuestionLabel];
    }
    return _detailReviewQuestionLabel;
}

- (UILabel *)impressionLabel {
    if (!_impressionLabel) {
        _impressionLabel = [[UILabel alloc]init];
        _impressionLabel.text = @"访问印象：";
        _impressionLabel.backgroundColor = [UIColor clearColor];
        _impressionLabel.textColor = [UIColor colorWithRed:0.8941 green:0.3765 blue:0.3686 alpha:1.0];
        [self.customContentView addSubview:_impressionLabel];
    }
    return _impressionLabel;
}

- (UILabel *)detailImpressionLabel {
    if (!_detailImpressionLabel) {
        _detailImpressionLabel = [[UILabel alloc]init];
        _detailImpressionLabel.numberOfLines = 0;
        _detailImpressionLabel.textColor = kTextColor;
        _detailImpressionLabel.backgroundColor = [UIColor clearColor];
        [self.customContentView addSubview:_detailImpressionLabel];
    }
    return _detailImpressionLabel;
}

#pragma mark - setter
- (void)setModel:(CheckingRecordCustomCellModel *)model {

    self.personNameLabel.text = model.personName;
    self.timeLabel.text = @"1232435465";
    self.detailRecordLabel.text = model.detailRecord;
    self.detailReviewQuestionLabel.text = model.detailReviewQuestion;
    self.detailImpressionLabel.text = model.detailImpression;

}
@end
